/**
 @file ctc_scl_cli.h

 @date 2009-12-22

 @version v2.0

*/

#ifndef _CTC_SCL_CLI_H_
#define _CTC_SCL_CLI_H_

#include "sal.h"
#include "ctc_cli.h"
#include "ctc_macro.h"

#define CHECK_FLAG(V, F)      ((V)&(F))
#define SET_FLAG(V, F)        (V) = (V) | (F)
#define UNSET_FLAG(V, F)      (V) = (V)&~(F)

#define SCL_IGMP_TYPE_HOST_QUERY                 0x11
#define SCL_IGMP_TYPE_HOST_REPORT                0x12
#define SCL_IGMP_TYPE_HOST_DVMRP                 0x13
#define SCL_IGMP_TYPE_PIM                        0x14
#define SCL_IGMP_TYPE_TRACE                      0x15
#define SCL_IGMP_TYPE_V2_REPORT                  0x16
#define SCL_IGMP_TYPE_V2_LEAVE                   0x17
#define SCL_IGMP_TYPE_MTRACE                     0x1f
#define SCL_IGMP_TYPE_MTRACE_RESPONSE            0x1e
#define SCL_IGMP_TYPE_PRECEDENCE                 0          /*temp, maybe change later*/
#define SCL_IGMP_TYPE_V3_REPORT                  0x22

#ifdef __cplusplus
extern "C" {
#endif



#define CTC_CLI_SCL_ASET_DESC \
"Pending status will not install to hw immediately", \
"Discard the packet", \
"Drop unknown ucast packet", \
"Drop unknown mcast packet", \
"Drop known ucast packet", \
"Drop known mcast packet", \
"Drop broadcast packet", \
"Statistic", \
"Reset to default action", \
"Copy to cpu", \
"Redirect to", \
"Forwarding ID", \
"VRF id of route", \
"Vlan edit", \
"Policer id",  \
"Source Category id", \
"Destination Category id", \
"The packet is span Flow", \
"Redirect port", \
"OAM enable",  \
"QoS map", \
"HMAC ID",  \
"Virtual network ID",\
"Logic port", \
"User vlanptr", \
"Aps selector", \
"Etree-leaf",\
"Stp Id",\
"PTP clock id", \
"Service ID", \
"Service acl enable",  \
"Logic port security enable", \
"Binding enable", \
"Metadata", \
"Deny bridge", \
"Deny learning", \
"Deny route", \
"Force bridge", \
"Force learning", \
"Force route", \
"Acl user outer info", \
"Force decap", \
"Snooping parser", \
"MAC limit", \
"Router MAC match", \
"Load balance hash select id",  \
"Enable IGMP snooping", \
"EFD action", \
"Udf", \
"Local arp", \
"Random Log",\
"EsLabel",\
"Dot1ae Channel ID",\
"Isolation ID",\
"L3 interface property",\
"Cos hbwp policer",\
"Change lookup priority",\
"Force mac da lookup to ipv4 lookup",\
"Force mac da lookup to ipv6 lookup",\
"Use outer header info do ipfix lookup, default use the inner",\
"Set logic port type",\
"Acl tcam en",\
"Acl hash en",\
"Flex edit",\
"Cancel other scl result",\
"Auxdata",\
"Xdata"


#define CTC_CLI_SCL_ASET_STR "\
| pending \
| discard \
| discard-unknown-ucast \
| discard-unknown-mcast \
| discard-known-ucast \
| discard-known-mcast \
| discard-bcast \
| stats \
| cancel-all  \
| copy-to-cpu \
| redirect \
| fid \
| vrf \
| vlan-edit\
| policer-id \
| src-cid \
| dst-cid \
| span-flow  \
| redirect-port \
| oam \
| qos-map \
| hmac-id \
| vni \
| logic-port \
| user-vlanptr  \
| aps-select \
| etree-leaf \
| stp-id  \
| ptp-clock-id  \
| service-id  \
| service-acl-en \
| logic-security-en \
| binding-en  \
| metadata \
| deny-bridge \
| deny-learning \
| deny-route \
| force-bridge \
| force-learning \
| force-route \
| acl-use-outer-info \
| force-decap \
| snooping-parser \
| mac-limit \
| router-mac-match \
| lb-hash-select-id  \
| igmp-snooping-en \
| efd-action  \
| udf-id  \
| local-arp \
| random-log  \
| es-label  \
| dot1ae-chan-id \
| isolation-id \
| l3if-property \
| cos-hbwp-policer \
| change-lkup-pri \
| ipv4-based-l2mc \
| ipv6-based-l2mc \
| ipfix-use-outer-info \
| logic-port-type  \
| acl-tcam-en \
| acl-hash-en \
| flex-edit \
| cancel-lkup-bmp \
| auxdata \
| xdata \
"

#define CTC_CLI_SCL_ASET_TYPE_SET(aset) \
do{\
    if(CTC_CLI_GET_ARGC_INDEX("aset") == 0xff)\
    {\
        break;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("pending");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_PENDING);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("discard");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_DISCARD) ;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("stats");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_STATS);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cancel-all");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_CANCEL_ALL);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("copy-to-cpu");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_COPY_TO_CPU) ;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("redirect");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_REDIRECT) ;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("fid");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_FID) ;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("vrf");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_VRFID) ;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("vlan-edit");\
    if (0xFF != index)\
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_VLAN_EDIT);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("policer-id");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_POLICER_ID);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("src-cid");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_SRC_CID);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("dst-cid");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_DST_CID);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("span-flow");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_SPAN_FLOW);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("redirect-port");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_REDIRECT_PORT);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("oam");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_OAM);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("qos-map");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_QOS_MAP);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("discard-unknown-ucast");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_DROP_UNKNOWN_UCAST) ;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("discard-unknown-mcast");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_DROP_UNKNOWN_MCAST) ;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("discard-known-ucast");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_DROP_KNOWN_UCAST) ;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("discard-known-mcast");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_DROP_KNOWN_MCAST) ;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("discard-bcast");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_DROP_BCAST) ;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("hmac-id");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_HMAC_ID);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("vni");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_VNI);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("logic-port");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_LOGIC_PORT) ;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("user-vlanptr");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_USER_VLANPTR);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("aps-select");\
    if (0xFF != index)\
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_APS);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("etree-leaf");\
    if (0xFF != index) \
    {\
       CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_ETREE_LEAF);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("stp-id");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_STP_ID);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ptp-clock-id");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_PTP_CLOCK_ID);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("service-id");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_SERVICE_ID);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("service-acl-en");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_SERVICE_ACL_EN);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("logic-security-en");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_LOGIC_PORT_SECURITY_EN);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("binding-en");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_BINDING_EN);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("metadata");\
    if (0xFF != index)\
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_METADATA);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("deny-bridge");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_DENY_BRIDGE);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("deny-learning");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_DENY_LEARNING);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("deny-route");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_DENY_ROUTE);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("force-bridge");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_FORCE_BRIDGE);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("force-learning");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_FORCE_LEARNING);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("force-route");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_FORCE_ROUTE);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("acl-use-outer-info");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_FLOW_LKUP_BY_OUTER_HEAD);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("force-decap");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_FORCE_DECAP);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("snooping-parser");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_SNOOPING_PARSER);\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mac-limit");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_MAC_LIMIT); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("router-mac-match");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_ROUTER_MAC_MATCH); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("lb-hash-select-id");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_LB_HASH_SELECT_ID); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("igmp-snooping-en");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_IGMP_SNOOP_EN); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("efd-action");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_EFD); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("udf-id");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_UDF_ID); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("local-arp");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_LOCAL_ARP); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("random-log");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_RANDOM_LOG); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("es-label");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_ESLB); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("dot1ae-chan-id");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_DOT1AE_CHAN_ID); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("isolation-id");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_ISOLATION_ID); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("l3if-property");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_L3IF_PROPERTY); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cos-hbwp-policer");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_COS_HBWP_POLICER); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("change-lkup-pri");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_CHANGE_LKUP_PRI); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ipv4-based-l2mc");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_IPV4_BASED_L2MC); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ipv6-based-l2mc");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_IPV6_BASED_L2MC); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ipfix-use-outer-info");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_IPFIX_LKUP_BY_OUTER_HEAD); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("logic-port-type");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_LOGIC_PORT_TYPE); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("acl-tcam-en");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_ACL_TCAM_EN); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("acl-hash-en");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_ACL_HASH_EN); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("flex-edit");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_FLEX_EDIT); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cancel-lkup-bmp");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_CANCEL_LKUP_BMP); \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("xdata");\
    if (0xFF != index) \
    {\
        CTC_BMP_SET(aset, CTC_SCL_FIELD_ACTION_TYPE_XDATA); \
    }\
}while(0);

extern int32
ctc_scl_cli_init(void);

#ifdef __cplusplus
}
#endif

#endif

